package com.ktjiaoyu.server.pojo;


import java.util.Scanner;

public class Dome {
    Scanner input=new Scanner(System.in);
    User user=new User();

    public void cd(){
        System.out.println("李导银行");
        System.out.print("输入账号:");
        String name=input.next();
        System.out.print("输入密码:");
        String password =input.next();
        if(name.equals(user.getName())|| password.equals(user.getPassword())){
            System.out.println("登录成功");
            cs();
        }else {
            System.out.println("账号或密码错误");
        }
        System.out.println();
    }
private void cs(){
    System.out.println("请选择:");
    int s=input.nextInt();
    switch (s){
        case 1:
            ck();
            break;
        case 2:
            cunkuan();
            break;
        case 3:
            break;
        case 4:
            break;
        case 5:
            System.out.println("退出");
            break;
        default:
            System.out.println("输入错误,请重新输入");
            s=input.nextInt();
            break;
    }
}
    private void cunkuan() {
        System.out.println("查看余额:"+user.getMomney());
        if(user.getMomney()==0){
            System.out.println("余额不足，请存入金额:");
            int momeny=input.nextInt();
            user.setMomney(momeny);
            System.out.println(momeny);
            momeny=momeny+user.getMomney();
        }else if(user.getMomney()>0){
            int momeny=input.nextInt();
            user.setMomney(momeny);
            System.out.println(momeny);
            momeny=momeny+user.getMomney();
        }
        System.out.println("查看余额:"+user.getMomney());
        cs();
    }

    public void ck() {
        System.out.println("注册");
        System.out.println("请输入账号:");
        String name =input.next();
        System.out.println("请输入密码:");
        String password=input.next();
        System.out.println("请输入年龄");
        int age=input.nextInt();
        System.out.println("请输入性别");
        String sex=input.next();
        user.setName(name);
        System.out.println(name);
        user.setPassword(password);
        System.out.println(password);
        cs();
    }
}
